/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bulkmailer.utils;

import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.UIManager.*;
import org.apache.log4j.Logger;

/**
 * @author G502497
 */
public class LookAndFeelUtils {
    public static void setLookAndFeel() {
        try {
            for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    Logger.getRootLogger().debug("look&feel set to nimbus");
                    UIManager.setLookAndFeel(info.getClassName());
                    break;
                } else {
                    Logger.getRootLogger().debug("Nimbus look&feel not found switching to platform's native");
                    if (OsUtils.isWindows()) {
                        UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
                    } else if (OsUtils.isLinux()) {
                        UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
                    } else {
                        UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
                    }
                }
            }

        } catch (ClassNotFoundException ex) {
            Logger.getRootLogger().error(ex.toString());
        } catch (InstantiationException ex) {
            Logger.getRootLogger().error(ex.toString());
        } catch (IllegalAccessException ex) {
            Logger.getRootLogger().error(ex.toString());
        } catch (UnsupportedLookAndFeelException ex) {
            Logger.getRootLogger().error(ex.toString());
        } catch (Exception ex) {
            Logger.getRootLogger().error(ex.toString());
        }
    }
}
